/* Written by Philippe De Muyter <phdm@macqel.be>.  */
char *strstr(const char *buf, const char *sub)
{
    assert(buf != NULL && sub != NULL);
    const char *bp;
    const char *sp;

    if ('\0' == *sub) {
        return buf;
    }

    while ('\0' != *buf) {
        bp = buf;
        sp = sub;

        do {
            if ('\0' == *sp) {
                return buf;
            }
        } while (*bp++ == *sp++);

        buf += 1;
    }

    return NULL;
}

